﻿namespace Yom.WebService
{
    using System;
    using System.Web;
    using Yom.Common;
    using Yom.WebService.Admin;

    public class _Admin : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Clear();
            context.Response.AppendHeader("Pragma", "no-cache");
            context.Response.AppendHeader("Cache-Control", "no-cache");
            context.Response.AppendHeader("Content-Type", "text/html; charset=utf-8");
            string Module = Factory.Request("Module");

            switch (Module)
            {
                case "Login":
                    new AdminLogin().OutWrite();
                    break;
                case "IsLogin":
                    new AdminBase().CheckAdmin();
                    break;
                case "Head":
                    new AdminBase().IsLogin();
                    new AdminHead().OutWrite();
                    break;
                case "Menu":
                    new AdminBase().IsLogin();
                    new AdminMenu().OutWrite();
                    break;
                case "Main":
                    new AdminBase().IsLogin();
                    new AdminMain().OutWrite();
                    break;
                case "Index":
                    new AdminBase().IsLogin();
                    new AdminIndex().OutWrite();
                    break;
                case "Config":
                    new AdminBase().IsLogin();
                    new AdminConfig().OutWrite();
                    break;
                case "Note":
                    new AdminBase().IsLogin();
                    new AdminNote().OutWrite();
                    break;
                case "Category":
                    new AdminBase().IsLogin();
                    new AdminCategory().OutWrite();
                    break;
                case "Comic":
                    new AdminBase().IsLogin();
                    new AdminComic().OutWrite();
                    break;
                case "Volume":
                    new AdminBase().IsLogin();
                    new AdminVolume().OutWrite();
                    break;
                case "Chapter":
                    new AdminBase().IsLogin();
                    new AdminChapter().OutWrite();
                    break;
                case "Link":
                    new AdminBase().IsLogin();
                    new AdminLink().OutWrite();
                    break;
                default:
                    new AdminDefault().OutWrite();
                    break;
            }
        }

        public bool IsReusable
        {
            get { return false; }
        }
    }
}